package com.bkgy.controller.tpdol3data.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.commom.model.Temp;
import com.bkgy.controller.tpdol3data.dao.TPdoL3Cal2150Dao;
import com.bkgy.controller.tpdol3data.entity.TPdoDataL3Cal2150;
import com.bkgy.controller.tpdol3data.entity.dto.TpdoL3CalBaseInfoRes;
import com.bkgy.controller.tpdol3data.entity.dto.TpdoL3CalDownRes;
import com.bkgy.controller.tpdol3data.entity.dto.TpdoL3CalRunRes;
import com.bkgy.controller.tpdol3data.service.ITPdoL3Cal2150Service;
import com.bkgy.sys.common.entity.ResultData;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Service
@RequiredArgsConstructor
public class TPdoL3Cal2150Servicempl extends ServiceImpl<TPdoL3Cal2150Dao, TPdoDataL3Cal2150> implements ITPdoL3Cal2150Service {
    private final TPdoL3Cal2150Dao mapper;

    @Override
    public ResultData<TpdoL3CalBaseInfoRes> findBaseInfo() {
        TpdoL3CalBaseInfoRes baseInfo = new TpdoL3CalBaseInfoRes();
        baseInfo.setShengchanl(BigDecimal.ZERO);
        baseInfo.setZhitongl(BigDecimal.ZERO);
        baseInfo.setZhitongbl(BigDecimal.ZERO);
        baseInfo.setJihuacl(BigDecimal.valueOf(3187));
        baseInfo.setShijicl(BigDecimal.valueOf(3187.29));
        baseInfo.setDachengl(BigDecimal.valueOf(1.0001));
        baseInfo.setYuechanl(BigDecimal.valueOf(59893.27));

        baseInfo.setChengcaijh(BigDecimal.valueOf(0.9785));
        baseInfo.setChengcaisj(BigDecimal.valueOf(0.9817));
        baseInfo.setChengcaijg("超欠");
        baseInfo.setChengcaijgz(BigDecimal.ZERO);

        baseInfo.setFeicilzb(BigDecimal.ZERO);
        baseInfo.setDangrifcl(BigDecimal.ZERO);
        baseInfo.setYueleijfcl(BigDecimal.ZERO);

        return ResultData.ResultDataSuccess(baseInfo);
    }

    @Override
    public ResultData<List<TpdoL3CalRunRes>> findRunList() {
        List<TpdoL3CalRunRes> runList = new ArrayList<>();
        TpdoL3CalRunRes obj1 = new TpdoL3CalRunRes();
        obj1.setShiduan("00:40-2:00");
        obj1.setShichang("");
        obj1.setYingxiangcl(BigDecimal.valueOf(120));
        obj1.setShuoming("来料边裂入口半卷回退影响产量");
        runList.add(obj1);

        TpdoL3CalRunRes obj2 = new TpdoL3CalRunRes();
        obj2.setShiduan("3:30-7:00");
        obj2.setShichang("");
        obj2.setYingxiangcl(BigDecimal.valueOf(70));
        obj2.setShuoming("宽板工艺影响产量");
        runList.add(obj2);

        TpdoL3CalRunRes obj3 = new TpdoL3CalRunRes();
        obj3.setShiduan("11:30-12:30");
        obj3.setShichang("");
        obj3.setYingxiangcl(BigDecimal.valueOf(60));
        obj3.setShuoming("生产508，物料不足无规格衔接料，规格变换比较多 影响产量");
        runList.add(obj3);

        TpdoL3CalRunRes obj4 = new TpdoL3CalRunRes();
        obj4.setShiduan("22:28-22:35");
        obj4.setShichang("");
        obj4.setYingxiangcl(BigDecimal.valueOf(25));
        obj4.setShuoming("出口窄接宽，操作侧月牙弯剪，挖边过大，月牙弯拽开，导致操作侧窝边，活套套量70，炉子降速配合");
        runList.add(obj4);

        return ResultData.ResultDataSuccess(runList,runList.size());
    }

    @Override
    public ResultData<List<TpdoL3CalDownRes>> findDownList() {
        List<TpdoL3CalDownRes> downList = new ArrayList<>();
        TpdoL3CalDownRes obj = new TpdoL3CalDownRes();
        obj.setMingcheng("");
        obj.setJiangjil(BigDecimal.valueOf(1.88));
        obj.setGuihu("连退机械");
        obj.setGuigeCol1("DC01-TS");
        obj.setGuigeCol2(BigDecimal.valueOf(0.9));
        obj.setGuigeCol3(BigDecimal.valueOf(1879));
        obj.setYuanyin("计划刨分卷，未取样，未切边，正常涂油，双侧边部轻微黑线铁皮夹杂平整液斑，头尾若有穿带甩尾造成的划伤精整切除归户连退机械。此卷带头100米左右穿带打滑如有划伤归户连退机械,7.9乙");
        obj.setDownType(0);
        downList.add(obj);

        return ResultData.ResultDataSuccess(downList,downList.size());
    }

    @Override
    public ResultData<List<TpdoL3CalDownRes>> findCloseList() {
        List<TpdoL3CalDownRes> closeList = new ArrayList<>();
        TpdoL3CalDownRes obj1 = new TpdoL3CalDownRes();
        obj1.setMingcheng("宽度不符");
        obj1.setJiangjil(BigDecimal.valueOf(28.52));
        obj1.setGuihu("制造部计划");
        obj1.setGuigeCol1("SPCC");
        obj1.setGuigeCol2(BigDecimal.valueOf(0.8));
        obj1.setGuigeCol3(BigDecimal.valueOf(1500));
        obj1.setYuanyin("封闭，宽度不符，此卷订货宽度1500mm来料宽度1590mm左右，连退已切边到1545mm需精整二次切边（此卷正常分卷2号机下大卷偏改分卷），带头15m下表面氧化铁皮压入");
        closeList.add(obj1);

        TpdoL3CalDownRes obj2 = new TpdoL3CalDownRes();
        obj2.setMingcheng("未剪边");
        obj2.setJiangjil(BigDecimal.valueOf(265.89));
        obj2.setGuihu("制造部");
        obj2.setGuigeCol1("HC420LA-L");
        obj2.setGuigeCol2(BigDecimal.valueOf(2));
        obj2.setGuigeCol3(BigDecimal.valueOf(1363));
        obj2.setYuanyin("封闭，制程在连退切边范围不在连退，1630检修无法编入计划，已联系科室同意不切边，此卷未切边，下大卷，已涂油取样。头尾下表面划伤，切除归连退机械。来料两侧肋部偶尔轻微斜纹，痕迹无手感，符合FB。钢种过渡加热温度波动大。");
        closeList.add(obj2);

        TpdoL3CalDownRes obj3 = new TpdoL3CalDownRes();
        obj3.setMingcheng("厚度不均");
        obj3.setJiangjil(BigDecimal.valueOf(49.62));
        obj3.setGuihu("北营轧钢");
        obj3.setGuigeCol1("DC01-H");
        obj3.setGuigeCol2(BigDecimal.valueOf(1.15));
        obj3.setGuigeCol3(BigDecimal.valueOf(1219));
        obj3.setYuanyin("封闭，带尾25米左右超薄，出口更换508套筒单机卷取，套量81不满足切除条件，精整切除。来料上下表面偶尔轻微夹杂，铁皮压入。边部轻微平整液斑。");
        closeList.add(obj3);

        TpdoL3CalDownRes obj4 = new TpdoL3CalDownRes();
        obj4.setMingcheng("夹杂");
        obj4.setJiangjil(BigDecimal.valueOf(19.51));
        obj4.setGuihu("北营炼钢");
        obj4.setGuigeCol1("HC420LA-L");
        obj4.setGuigeCol2(BigDecimal.valueOf(2));
        obj4.setGuigeCol3(BigDecimal.valueOf(1060));
        obj4.setYuanyin("封闭。切除带尾30m下表面夹杂");
        closeList.add(obj4);

        TpdoL3CalDownRes obj5 = new TpdoL3CalDownRes();
        obj5.setMingcheng("内径不合");
        obj5.setJiangjil(BigDecimal.valueOf(31.5));
        obj5.setGuihu("制造部计划");
        obj5.setGuigeCol1("DC01-H");
        obj5.setGuigeCol2(BigDecimal.valueOf(1.55));
        obj5.setGuigeCol3(BigDecimal.valueOf(1219));
        obj5.setYuanyin("封闭。计划要求508卷取，实际用610卷取，此卷为高强钢衔接料，入口测量宽度1223，此卷已联系生产科，生产科同意此卷衔接料。精整检查带尾是否有穿带甩尾造成划伤，若有切除归户机械。");
        closeList.add(obj5);

        return ResultData.ResultDataSuccess(closeList,closeList.size());
    }

    @Override
    public List<Temp> selectPage(int rollNum) {
        return mapper.selectLastRoll(rollNum);
    }
}